﻿@model List<EquipmentManager.Entities.Directorate>

@{
    ViewBag.Title = "Список дирекций";
}

@section menu {
    <section class="featured">
            <div class="master-menu">
                @{Html.RenderPartial("AdminMenu");}
            </div>
    </section>
}

<p>@Html.ActionLink("+ Добавить новую дирекцию", "CreateDirectorate", "Admin", new { @class = "common-btn BlueColor" })</p>

<h2>Список дирекций</h2>

<table class="bordered">
    <thead>
        <tr>
            <th>Районы</th>
            <th>Добавить</th>
            <th>Название</th>
            <th>Описание</th>
            <th>Районов</th>
            <th>Правка</th>
            <th>Удалить</th>
        </tr>
    </thead>
    @foreach (var directorate in Model)
    {
        <tr>
            <td class="Center column-detail">@Html.ActionLink("Районы", "Regions", "Admin", new { DirectorateId = directorate.Id }, new { @class = "common-btn BlueColor" })</td>
            <td class="Center column-detail">@Html.ActionLink("+ Район", "CreateRegion", "Admin", new { DirectorateId = directorate.Id }, new { @class = "common-btn BlueColor" })</td>
            <td>@directorate.Name</td>
            <td>@directorate.Description</td>
            <td class="Center">@directorate.Regions.Where(r => r.Status == EquipmentManager.Entities.EntityStatus.Active).Count()</td>
            <td class="Center column-detail">@Html.ActionLink("Правка", "EditDirectorate", "Admin", new { DirectorateId = directorate.Id }, new { @class = "common-btn BlueColor" })</td>
            <td class="Center column-detail">@Html.ActionLink("Удалить", "DeleteDirectorate", "Admin", new { DirectorateId = directorate.Id }, new { @class = "common-btn RedColor" })</td>
        </tr>
    }
</table>
